<?php if(isset($fromCommune) && "none"!=$fromCommune){ ?>
	<div class="square info" id="fromDiv">
		<span><?php echo $fromCommune->name; ?></span>
	</div>
	<?php if(isset($animateFrom)) {?>
		<script>
		$(document).ready(
				function() {
					$( "#fromDiv" ).show( <?php echo $animateFrom; ?>);
				}
			);
		</script>
	<?php } ?>
	
<?php } ?>

<?php if(isset($toCommune) && "none"!=$toCommune){ ?>
	<span id="arrowDestination">
		<img src="/meditravel/images/yellow_arrow.png"/>
	</span>
	<div class="square info" id="toDiv">
		<span><?php echo $toCommune->name; ?></span>
	</div>
	<?php if(isset($animateTo)) {?>
		<script>
		$(document).ready(
				function() {
					$( "#toDiv" ).show( <?php echo $animateTo; ?> );
				}
			);
		</script>
	<?php } ?>
	

<?php } ?>

<?php if(isset($organisations)) { ?>
	<div class="square info" id="descDiv">
		<?php if( sizeof($organisations) >0){?>
			<div class="CSSTableGenerator">
				<table>
					<tr>
						<td>Nom</td>
						<td>Contact</td>
						<td>Tél/Gsm </td>
						<td>Permanence</td>
						<td>Horaire</td>
					</tr>
				<?php foreach ($organisations as $org){ ?>
					<tr id="orgId<?php echo $org->id;?>" style="cursor: pointer;">
						<td id="orgName<?php echo $org->id;?>"><?php echo $org->name; ?></td>
						<td><?php echo $org->contactName; ?></td>
						<td>
							<?php echo $org->phone;?>
							<?php if($org->cellPhone!=""){
								echo $org->cellPhone;
							} ?>
						</td>
						<td><?php echo $org->telPermanence; ?></td>
						<td><?php echo $org->workHours; ?></td>
						
					</tr>
				<?php }?>
				</table>
			</div>
		<?php } else {?>
			<span>Aucune information disponible</span>
		<?php }?>
	</div>
	<?php if(isset($animateTo)) {?>
		<script>
		$(document).ready(
				function() {
					$( "#descDiv" ).show('blind',500 );
					$('#orgTableId').dataTable();
					$("[id^='orgId']").click(function() {
						$( "#dialog-modal" ).html("");
						$( "#dialog-modal" ).removeAttr("title");
						$( "#dialog-modal" ).attr("title",$("#orgName"+this.id.substring(5)).html());
						$( "#dialog-modal" ).load("/meditravel/index.php/edit/organisation/view/"+this.id.substring(5));
						$( "#dialog-modal" ).show();
						$( "#dialog-modal" ).dialog({
						      height: 500,
						      width: 700,
						      modal: true,
						      close: function( event, ui ) {
						    	  $(this).remove();
						    	  $("body").append("<div style='display: none;' id='dialog-modal'></div>");
							  }
						    });
					});
				}
			);
		</script>
	<?php } ?>
<?php } ?>

<div style="display: none;" id="dialog-modal"></div>